package com.jiadakeji.ppm.api.v1;

import com.jiadakeji.ppm.api.common.JsonResult;
import com.jiadakeji.ppm.common.web.BaseController;
import com.jiadakeji.ppm.modules.business.dao.BuildingDao;
import com.jiadakeji.ppm.modules.business.entity.Building;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * @author hhaoyu
 */
@RestController("v1_buildingController")
@RequestMapping(value = "${apiPath}/v1/building")
public class BuildingController extends BaseController {
    @Autowired
    private BuildingDao buildingDao;

    @RequestMapping(value = "/list")
    @ApiOperation(value = "获取楼栋列表",httpMethod = "POST",consumes="application/json",notes="根据id")
    public JsonResult<List<Building>> list(@RequestBody Building building, HttpServletRequest request, HttpServletResponse response){
        JsonResult<List<Building>> result = new JsonResult<>();

        List<Building> buildingList = buildingDao.findList(building);
        result.setData(buildingList);
        return result;
    }


}
